;
! function () {
    window.onload = function () {
        'use strict';
        var id = GetQueryString('id')

        getDetail(id)

        // 点击调用视频
        function paly_video(videoPath) {
            $('#play').click(function (videoPath) {
                var player = new YKU.Player('youkuplayer', {
                    styleid: '0',
                    client_id: 'YOUR YOUKUOPENAPI CLIENT_ID',
                    vid: videoPath,
                    newPlayer: true,
                    autoplay: true
                });
                $('.play_mask').show()
            })
        }

        // 获取分享相关信息
        function getDetail(id) {
            $.ajax({
                url: '/webp2p_interface_mysql/comment/commentAndReplyList?videoId=' + id,
                type: 'GET',
                dataType: 'json',
                success: function (res) {
                    if (res.result === '0000') {
                        var detailObj = res.data
                        // console.log(detailObj)
                        $('.video>img').attr('src',detailObj.imgPath)
                        paly_video(detailObj.videoPath)
                    }
                },
                error: function (xhr) {
                    showErrorToast(xhr, '');
                }
            })
        }

        //获取url参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }

    }
}();